package com.sheng.project.common;

import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.UUIDGenerator;

import java.io.Serializable;

/**
 * @author by ls
 * @date 2023/8/21
 */
public class DefaultUUIDGenerator extends UUIDGenerator {

    @Override
    public Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException {
        if (object == null) {
            throw new HibernateException(new NullPointerException());
        }
        return super.generate(session, object).toString().replace("-", "");
    }
}
